
pathtolexer=$(cat ../filelist.json | grep "lexcheck.h" | tr -d '"' | tr -d ',' | sed 's/  *//' | sed 's/^\./\.\.\/\.\.\/\.\./')
parser1=$(cat ../filelist.json | grep "parser_options.h" | tr -d '"' | tr -d ',' | sed 's/  *//' | sed 's/^\./\.\.\/\.\.\/\.\./')
parser2=$(cat ../filelist.json | grep "parser_functions.h" | tr -d '"' | tr -d ',' | sed 's/  *//' | sed 's/^\./\.\.\/\.\.\/\.\./')

all_args_lexer=$(cat $pathtolexer | sed -n '1,/XLEN_ALL_ARGS/p' | head -n -1 | grep "#define" | grep -v XRNL | grep -v XLEXCHECK_H | grep -v XN_NULL | grep -v XH_HELP | grep -v XS_SCRIPT | grep -v XE_EXAMPLE | grep -v COMMAND_LINE_LOG | awk '{ print $2 }' | awk '{print $1}')
#echo $all_args_lexer

all_args_parser=$(cat $parser1 $parser2 | awk '/\.command =/ {print $0 }' | sed 's/^.*=//g' | tr -d ',' | sort | uniq )
#echo $all_args_parser


unique_to_string1=$(echo "$all_args_lexer $all_args_parser" | tr ' ' '\n' | sort | uniq -u | tr -s '\n' ' ')

if [ -z "$unique_to_string1" ]; then
    echo "correct"
else

    echo "lexcheck.h    list: " $all_args_lexer
    echo "parser        list: " $all_args_parser
    echo "fail          list: " $unique_to_string1
fi

